//
//  YJYPictureBrowsersTransitionParamer.m
//  BannerViewDemo
//
//  Created by BaizYi on 2018/11/5.
//  Copyright © 2018 BaizYi. All rights reserved.
//

#import "YJYPictureBrowsersTransitionParamer.h"

@implementation YJYPictureBrowsersTransitionParamer

-(void)setTransitionImage:(UIImage *)transitionImage{
    _transitionImage = transitionImage;
    _secendVCImgFrame = [self backScreenImageViewRectWithImage:transitionImage];
}

-(void)setTransitionImgIndex:(NSInteger)transitionImgIndex{
    _transitionImgIndex = transitionImgIndex;
    _firstVCImgFrame = [_firstVCImageFrames[transitionImgIndex] CGRectValue];
}

-(CGRect)backScreenImageViewRectWithImage:(UIImage *)image{
    CGSize size = image.size;
    CGSize newSize;
    newSize.width = SCREENWIDTH;
    newSize.height = (newSize.width / size.width) * size.height;
    CGFloat imageY = (SCREENHEIGHT - newSize.height) * 0.5;
    if (imageY < 0) {
        imageY = 0;
    }
    CGRect rect = CGRectMake(0, imageY, newSize.width, newSize.height);
    NSLog(@"--rect:%@--%@", [NSValue valueWithCGSize:image.size],[NSValue valueWithCGSize:rect.size]);
    return rect;
}


@end
